<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="MobileOptimized" content="320">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta name="HandheldFriendly" content="true">
<meta name="author" content="johnye">
<meta name="shenma-site-verification" content="f28da5e2e3fb6e2afd372a3eedfda998">
<meta name="baidu-site-verification" content="eafwEzRbnz">
<title>外卖人</title> 
<link rel="stylesheet"  href="__PUBLIC__/wxsite/css/public1.css"> 
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wxsite/css/newweixin.css"> 
  <link rel="stylesheet"  href="__PUBLIC__/wxsite/newcss/index.css">
  <link rel="stylesheet"  href="__PUBLIC__/wxsite/newcss/font-awesome.min.css">
   <link rel="stylesheet" type="text/css" href="__PUBLIC__/wxsite/css/newscrollbar.css">
  <link rel="stylesheet" href="__CSS__/base.css?v=20150805">
<link rel="stylesheet" type="text/css" href="__CSS__/demo.css" />

<link rel="stylesheet" type="text/css" href="__CSS__/menu_sideslide.css?v=201508091" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/fonts/font-awesome-4.2.0/css/font-awesome.min.css" />


	<script src="__PUBLIC__/wxsite/js/jquery.js"></script> 
  <script src="__PUBLIC__/wxsite/js/public.js"></script>  
 <!-- <script src="http://localhost/wmrshop/templates/adminpage/public/js/allj.js"></script>  -->
   <script src="__PUBLIC__/wxsite/js/swipe.js"></script> 
    <script src="__PUBLIC__/wxsite/js/iscroll.js"></script> 
    <script src="__PUBLIC__/wxsite/js/newiscroll.js"></script>  
  <script src="__PUBLIC__/wxsite/js/template.min.js"></script>    
    <script src="__PUBLIC__/wxsite/js/wxshop.js"></script>  
   <script src="__PUBLIC__/wxsite/js/cart.js"></script> 
<script type="text/javascript" src="__JS__/jquery-1.12.2.min.js"></script>
<script src="__JS__/jquery.tabs.js"></script>




   <script>
   	 var shopid = 4;
   	 var is_goshop = 1;
   	 var checknext = false;
   	 var shoplimitcost = '11';
   	 var zuocart = 'http://localhost/wmrshop/index.php?ctrl=wxsite&action=gowei&id=4';
   	 
   	  $(function(){ 
	if( is_goshop == 0 ){
		if( shoplimitcost == 0 ){
			$("#addShopping").show();
		}else{
			$("#showlimit").show();
		}
  
  }else{
      
  $("#addShopping").show();
  $("#showlimit").hide();
  }
	  
  		/*初始化样式*/
  		   url = siteurl+'/index.php?ctrl=wxsite&action=cart&shopid='+shopid+'&datatype=json&random=@random@';
        url = url.replace('@random@', 1+Math.round(Math.random()*1000));
      	var bk = ajaxback(url,''); 
      	 initshop(bk);
      	 
 
           	});
  	function myyanchi(){
  		
  		  checknext = false;
  	}
  	function sortitemclick(doid,obj){  
  	  // var scroptop= $('#listto_'+doid).offset().top-40;// checktype == '1'?Number($("#sort_sh_"+doid).offset().top)-81:Number($("#sort_sh_"+doid).offset().top)-162;
  	 // alert(doid);
  	  //right_list
  	   
  	  var defaultheight = 0;
  	  var listobj = $('.right_list_box');
  	  for(var i=0;i<$(listobj).length;i++){
  	   
  	    if($(listobj).eq(i).attr('data') == doid){
  	     
  	       break;
  	    }else{ 
  	       defaultheight = Number(defaultheight)+Number($(listobj).eq(i).height());
  	     }
  	  }
  	  $(obj).addClass('on').siblings().removeClass('on'); 
  	  scroll2.scrollTo(0,Number(defaultheight)*-1,200,false); 
 
    }
  	function initshop(datas){ 
 
  		 $('.onselect').removeClass('onselect');
	         	 $('.righ_l_b_btn_moren').show();
	         	 $('.righ_l_b_btn_hover').hide();
	         	 $('.cartshuliang').hide();
	         	 $('.right_l_btn_nub').val(0);
	         	 $('.cartshuliang').text(0);
	         	 $('#total_count').text(0);
	         	 $('#total_money').text(0);
	      if(datas.flag == false){    
	         if($('#total_money').html() != undefined){ 
	         	
	         	    $('.qipao').text(0);
	         	 $.each(datas.content.list, function(i,val){   
	         	 	
	         	 	 if($('#gidli_'+val.id).html() != undefined){  
	         	 	 	  var typeid = $('#gidli_'+val.id).attr('typeid');
  	                 $('#gidli_'+val.id).addClass('onselect');
					  
					               if($('#cp_'+val.typeid).html() != undefined){
									   if($('#cp_'+val.typeid).find('.qipao').eq(0).html() != undefined){  
										     var othershu = Number($('#cp_'+val.typeid).find('.qipao').eq(0).text())+Number(val.count);
										    $('#cp_'+val.typeid).find('.qipao').eq(0).text(othershu);
										  
									   }else{ 
										  $('#cp_'+val.typeid).append('<div class="qipao" style="position: absolute; margin-top: 5px; right: 5px; width: 16px; height: 16px; line-height: 13px; text-align: center; color: rgb(255, 255, 255); background-image: url(/upload/images/qipao.png); background-size: 16px; background-position: 0px 0px; background-repeat: no-repeat no-repeat;  display: inline-block;">'+val.count+'</div>');
										}
								  }
    
					 
					 
					 
	                 
	                 $('#gshu_'+val.id).val(val.count); 
	                $('#gidli_'+val.id).find('.righ_l_b_btn_moren').eq(0).hide();
	                $('#gidli_'+val.id).find('.righ_l_b_btn_hover').eq(0).show();
					//alert('#gshu_'+val.id);
	                 $('#gshu_'+val.id).show();
	         	 	 } 
	          	}); 
	          	$('#total_count').text(datas.content.sumcount);
				checkcartifempty();
				var shijicost = datas.content.sum;
	          	$('#total_money').text(shijicost.toFixed(2));
				
	          	if(Number(datas.content.sum) >= Number(shoplimitcost)){
	          		 $('#showlimit input').val('');
					 $("#addShopping").show();
					 $("#showlimit").hide();
					
	          	}else{
	          	        var checkcost = Number(shoplimitcost)-Number(datas.content.sum);
						checkcost = checkcost.toFixed(2);
							          	        $('#showlimit input').val('还差'+checkcost+'元');
												 $("#addShopping").hide();
						$("#showlimit").show();
	          	         
	          	}
        	 }else{
					
        	 }
        }
	 
    }
	
	
//加购物车动画
function cartimg(obj,gid){
 	if( $(obj).offset() ==  undefined ){
				freshcart();
	}else{
 	 
	     $("#addload").show(); 
        var pos =$(obj).offset();
       var topval = pos.top;
       $("#addload").css("top", topval + "px"); 
       $("#addload").css("left", pos.left + "px");
        $("#addload").css({'width':'15px','height':'15px'}); 
       var target_ob = $('#total_count').offset();
       var target_top = Number(target_ob.top);
       var target_left = Number(target_ob.left);
       $("#addload").animate({top:target_top,left:target_left, 'width':'0px','height':'0px'});  
       $('#total_count').text(Number($('#total_count').text())+1);
	   
	   checkcartifempty();
	   
	          if($('#cp_'+$('#gidli_'+gid).attr('typeid')).find('.qipao').eq(0).html() != undefined){
				  var othershu = Number($('#cp_'+$('#gidli_'+gid).attr('typeid')).find('.qipao').eq(0).text())+1;
				 
				  $('#cp_'+$('#gidli_'+gid).attr('typeid')).find('.qipao').eq(0).text(othershu);
			   }else{ 
				   $('#cp_'+$('#gidli_'+gid).attr('typeid')).append('<div class="qipao" style="position: absolute; margin-top: 5px; right: 5px; width: 16px; height: 16px; line-height: 13px; text-align: center; color: rgb(255, 255, 255); background-image: url(/upload/images/qipao.png); background-size: 16px; background-position: 0px 0px; background-repeat: no-repeat no-repeat;  display: inline-block;">1</div>');
			   }
			   
	   
	 //  	var shijicost = datas.content.sum;
	   //       	$('#total_money').text(shijicost.toFixed(2));
	   
	   var sjcost111 = Number($('#total_money').text())+Number($(obj).attr('data-price'));
	   
	    	$('#total_money').text( sjcost111.toFixed(2) ); 
	    	
	    	if(Number($('#total_money').text()) >= Number(shoplimitcost)){
	          		  $('#showlimit input').val('');
					 $("#addShopping").show();
					 $("#showlimit").hide();
	          	}else{
	          	        var checkcost = Number(shoplimitcost)-Number($('#total_money').text());
						checkcost = checkcost.toFixed(2);	          	        
							          	        $('#showlimit input').val('还差'+checkcost+'元');
												 $("#addShopping").hide();
						$("#showlimit").show();
	          	        
	          	}
	    	
	    	
	    	$('#gidli_'+gid).find('.righ_l_b_btn_moren').hide();
	    	$('#gidli_'+gid).find('.righ_l_b_btn_hover').show();
	  //    var typeid = $(obj).attr('typeid');
	  //    $('#typelist'+typeid).show();
	 //     $('#typelist'+typeid).text(Number($('#typelist'+typeid).text())+1);
	      $('#gidli_'+gid).addClass('onselect');
	      $('#gshu_'+gid).val(Number($('#gshu_'+gid).val())+1); 
		  $('#gshu_'+gid).show();
		  $('#total_count').show();
 	}  
	    	//if($(valse).is(':checked') == true)
} 

function removeonedish(gid,tshopid,num){ 

	   $('#loading').show();
	   url = siteurl+'/index.php?ctrl=site&action=downcart&goods_id='+gid+'&shopid='+tshopid+'&num=1&datatype=json&random=@random@';
	  	 url = url.replace('@random@', 1+Math.round(Math.random()*1000));
    	var bk = ajaxback(url,'');
	    if(bk.flag == false){ 
	       if($('#total_money').html() != undefined){
 
			checkcartifempty();
			  
			 var sjcost222 = $('#total_money').text()-Number(   $('#gidli_'+gid).attr('data-price')   );
	         notypenum = Number(sjcost222.toFixed(2)); 
	          $('#total_money').text(notypenum);
	         if(notypenum < 0){
	         	$('#total_money').text(0);
	         }
			 
			 notypenum = Number($('#total_count').text())-1;
	         $('#total_count').text(notypenum);
	         if(notypenum < 1){
	         	  $('#total_count').text(0);
	         }
			 
	         	if(Number($('#total_money').text()) >= Number(shoplimitcost)){
	          		 $('#showlimit input').val('');
					 $("#addShopping").show();
					 $("#showlimit").hide();
	          	}else{
	          	        var checkcost = Number(shoplimitcost)-Number($('#total_money').text());
						checkcost = checkcost.toFixed(2);
	          	         	          	        $('#showlimit input').val('还差'+checkcost+'元');
												 $("#addShopping").hide();
						$("#showlimit").show();
	          	        
	          	}
	         notypenumcount = Number($('#gshu_'+gid).val()) -1;
	          $('#gshu_'+gid).text(notypenumcount);
	         if(notypenumcount < 1){
				$('#cp_'+$('#gidli_'+gid).attr('typeid')).find('.qipao').eq(0).remove();
	         	$('#gshu_'+gid).val(0);
	         	$('#gidli_'+gid).removeClass('onselect');
	         	$('#gidli_'+gid).find('.righ_l_b_btn_hover').hide(); 
	         	$('#gidli_'+gid).find('.righ_l_b_btn_moren').show();
				$('#gshu_'+gid).hide();
			 
	         }else{
				 $('#gshu_'+gid).val(Number($('#gshu_'+gid).val())-1); 
			 } 
	   	   }else{ 
	   	    	  freshcart();
				  
	   	   }
	    }else{
	    	Tmsg(bk.content);
	    }
	  $('#loading').hide();
}
function checkcartifempty(){    //检查购物车是否为空

	
	         	if( $('#total_count').html() == 0 ){
					$(".ordeilpaymenshop").hide();
					$(".emptycartBg").show();
					$(".ordeilpaymen").hide();
					$(".emptyordeilpaymen").show();
				}else{
					$(".ordeilpaymenshop").show();
					$(".emptycartBg").hide();
					$(".ordeilpaymen").show();
					$(".emptyordeilpaymen").hide();
				}
			 

} 

   	  </script>

<script> 
	var siteurl = "http://localhost/wmrshop";
	var is_static ="3";
	var taction = "shopshow"; 
</script>

<script>
var baoshifu = false;
var scroll1, scroll2,scroll3,scroll4,scroll5;
function loaded() { 
	scroll1 = new iScroll('standard',{hScrollbar:false, vScrollbar:false,bounce:false});  //	hScrollbar:false, 		vScrollbar:false,		useTransition: true,//
	scroll2 = new iScroll('transition', {hScroll:false,hScrollbar:false, vScrollbar:false,onScrollEnd:function(e){
	 
     },bounce:false});
 scroll3 = new iScroll('getpinglun',{hScrollbar:false, vScrollbar:false,bounce:false}); 
 scroll4 = new iScroll('getdetailinfo',{hScrollbar:false, vScrollbar:false,bounce:false}); 
 scroll5 = new iScroll('showorderdet',{hScrollbar:false, vScrollbar:false,bounce:false}); 
	if( baoshifu == false ){
		baoshifu = true;
		getcatefoods();	
	}
}

document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);

</script>



{:hook('pageHeader')}
